#!/usr/bin/env python3

import numpy as np
import pyboof as pb
import time

# Detects all the QR Codes in the image and prints their message and location
# data_path = "D:/research/database/2D_code/QR2j.jpg"
data_path =  "../../resource/janpos_test/1_7.bmp"
detector = pb.FactoryFiducial(np.uint8).qrcode()

image = pb.load_single_band(data_path, np.uint8)

print("ready to detect...")
t0 = time.time()
detector.detect(image)

print(time.time() - t0, "s")
print("Detected a total of {} QR Codes".format(len(detector.detections)))

for qr in detector.detections:
    print("Message: " + qr.message)
    print("     at: " + str(qr.bounds))